<?php
/*
 * IKPHP 爱客开源社区 @copyright (c) 2012-3000 IKPHP All Rights Reserved 
 * @author 小麦
 * @Email:ikphp@sina.cn 2014年8月27日16:58:00
 * @小组应用 基础类
 */
namespace IKPHP\Apps\Group\Controllers;
use IKPHP\Common\Controllers\FrontendController;
use IKPHP\Apps\Group\Models\GroupCate;

class GroupBaseController extends FrontendController {
	
	public function initialize() {
		parent::initialize ();
		//生成导航
		$this->assign('ik_app_nav',$this->_pagenav()); 
		//生成后台配置
		$this->fcache('group_setting');		
		
	}	
	
	// 覆盖父类导航
	protected  function _pagenav(){
		// 小组导航
		$arrNav = array();
		$arrCate = GroupCate::getCates();
		if($this->visitor['userid'] > 0){
			$arrNav['mine'] = array('name'=>'我的小组', 'url'=>U('group/mine'));
		}
		$arrNav['groups'] = array('name'=>'发现小组', 'url'=>U('group/explore'));
		$arrNav['topics'] = array('name'=>'热帖', 'url'=>U('group/explore/topics'));
		
		foreach ($arrCate as $v){
			$arrNav[$v['alias']] = array('name'=>$v['catename'], 'url'=>U('group/explore/'.$v['alias']));
		}
		return $arrNav;
	}
}